package 题目集.dfs.组合;

import java.util.Scanner;

//排列组合
public class 掷骰子 {
    static int[] s=new int[3];
    static int[] res={-1,0}; //0：凑成该点的组合数，1:点数
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int sum=0;
        for (int i = 0; i < s.length; i++) {
            s[i]= sc.nextInt();;
            sum+=s[i];
        }
        for (int i = 3; i <= sum; i++) {
            int fun = fun(2, i);
            if (fun>res[0]){
                res[0]=fun;
                res[1]=i;
            }
        }
        System.out.println(res[1]);
    }

    /**
     * 剩余i个选择时，凑出金额为rest的情况为多少
     */
    public static int fun(int i,int rest){
        if (i==0&&rest<=s[0]&&rest>0){
            return 1;
        }
        if (i==0){
            return 0;
        }
        int res=0;
        for (int j = 1; j <= s[i]&&j<=rest; j++) {
            res+=fun(i-1,rest-j);
        }
        return res;
    }
}
